package site.wanjiahao.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import site.wanjiahao.entity.FileEntity;

import java.io.FileNotFoundException;
import java.io.IOException;

public interface FileService extends IService<FileEntity> {

    /**
     *
     * @param rootPath 指定上传路径
     * @param file 文件对象
     */
    String upload(String rootPath, MultipartFile file) throws IOException;

    /**
     * 上传至upload文件夹下
     * @param file 文件对象
     */
    String upload(MultipartFile file) throws IOException;

    /**
     * 根据文件uuid获取文件在服务器的绝对路径
     * @param uuid uuid
     * @return 文件的绝对路径
     */
    FileEntity getAbsoluteFilePathByUUID(String uuid) throws FileNotFoundException;

    FileEntity findByUUID(String uuid);
}
